<script>
    var idempleado;
    
    $(document).ready(function() {
        $("#window").kendoWindow({
        width: "300px",
        title: "",
        modal:true,
        visible:false,
        resizable: false
        });
    });
    
    function eliminarjs(id){
        var window=$("#window").data("kendoWindow");
        window.center();
        window.open();
        idrollo=id;
    }
    
    function cancelar(){
        
        var window = $("#window").data("kendoWindow");
        window.close();
        
    }
</script>
<fieldset>

    <?php
    $atributos = array('id' => 'rollo_form', 'class' => 'form_rollo', 'name' => 'rollo_form');

    echo form_open('rollo/validarRollos', $atributos);

    $data1 = array(
        'name' => 'idRollo',
        'id' => 'idRollo',
        'value' => set_value('idRollo'),
        'class'=>'sinput'
    );

    $data2 = array(
        'name' => 'idEspecie',
        'id' => 'idEspecie',
        'value' => set_value('idEspecie'),
        'class'=>'sinput'
    );


    $data3 = array(
        'name' => 'largoRollo',
        'id' => 'largoRollo',
        'value' => set_value('largoRollo'),
        'class'=>'sinput');



    $data4 = array(
        'name' => 'circunferenca',
        'id' => 'circunferencia',
        'value' => set_value('circunferencia'),
        'class'=>'sinput');
    ?>
<div id="window"><p>¿Esta seguro que desea Borrar el Rollo?</p>
    <a class="k-button"href="javascript:;" onclick="window.location.href=BASE_URL+'rollo/eliminarRollo/'+idrollo">Aceptar</a>
    <a class="k-button"onclick="cancelar()">Cancelar</a>
</div>
    <h1>Ingreso de Rollos del Remito</h1>   <h1>N°<?php echo $numeroRemito ?></h1>
    <p>Registrar Ingreso de Rollos</p>



    <?php echo form_label('Codigo de Rollo:') ?>
    <?php echo form_input($data1); ?>

    <span class="errors">
        <?php
        echo "<br></br>".form_error('idRollo');
        ?>
    </span> 

    <?php echo form_label('Largo Rollo:') ?>
    <?php echo form_input($data3); ?>

    <span class="errors">
        <?php
        echo "<br></br>".form_error('largoRollo');
        ?>
    </span> 

    <?php echo form_label('Circunferencia:') ?>
    <?php echo form_input($data4); ?>

    <span class="errors">
        <?php
        echo "<br></br>".form_error('circunferencia');
        ?>
    </span> 

    <?php echo form_label('Especie:'); ?>

    <select name="comboEspecie" class="select2">
        <option value="-1">Seleccionar</option> 
        <?php
        foreach ($especies as $i => $datos) {
            echo "<option value='" . $datos['idEspecie'] . "'>" . $datos['nombre'] . "</option>";
        }
        ?>
    </select>
    
    <div id="popup"><a href="<?php echo base_url(); ?>especie" rel="pop-up">Nueva Especie</a></div>
    
    <input type="hidden" name="remito" value="<?php echo $numeroRemito ?>"/>

    <input type="submit" id="registrar"  value="Cargar Rollos" style="margin-rigth: 5em;"/>

    <?php echo form_close(); ?>
    
</fieldset>
<fieldset>    
    <h1>Ingreso de Rollos</h1>     
</fieldset>
<fieldset style="width: 800px;">
<table id="tabla" cellspacing="0">
        
        <tr>
            <th class="elthini"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 1, keepRelationships: true, sortType: 'numeric'})" style="color:#333333;">ID Rollo</a></th>
            <th class="elth"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 2, keepRelationships: true})" style="color:#333333;">Especie</a></th>
            <th class="elth"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 3, keepRelationships: true, sortType: 'numeric'})" style="color:#333333;">Largo</a></th>
            <th class="elth"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 4, keepRelationships: true, sortType: 'numeric'})" style="color:#333333;">Circunferencia</a></th>
            <th class="elth"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 5, keepRelationships: true, sortType: 'numeric'})" style="color:#333333;">Metros Cubicos</a></th>
            <th class="elth"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 6, keepRelationships: true, sortType: 'numeric'})" style="color:#333333;">Remito</a></th>
            <th class="elthfin"><a class='bold' href="javascript:$('#tabla').sortTable({onCol: 6, keepRelationships: true, sortType: 'numeric'})" style="color:#333333;">Eliminar</a></th>
       
        </tr>
        <?php foreach($tabla_rollo as $i=>$id){ ?>
        <tr>
            <td class="eltd" style="width: 100px;"><?php echo $id['idRollo'] ?></td>
            <td class="eltd" style="width: 100px;"><?php echo $id['nombre'] ?></td>
            <td class="eltd" style="width: 100px;"><?php echo $id['largo'] ?></td>
            <td class="eltd" style="width: 100px;"><?php echo $id['circunferencia'] ?></td>
            <td class="eltd" style="width: 150px;"><?php echo $id['m3_rollo'] ?></td>
            <td class="eltd" style="width: 100px;"><?php echo $id['id_remito'] ?></td> 
            <td class="eltd"><a href="javascript:;" title="Eliminar"  onclick="eliminarjs('<?php echo $id['idRollo']?>')"><img src="<?php echo base_url() ?>css/images/delete.png" alt="" /></a></td>
        </tr>
        <?php }?>
</table>
</fieldset>